package cloudInformation.service.impl;

import cloudEntity.dto.dorm.SmartDormFloorUpdateDTO;
import cloudEntity.vo.PageBeanVO;
import cloudEntity.dto.dorm.SmartDormFloorInsertDTO;
import cloudEntity.vo.dorm.SmartDormFloorVO;
import cloudInformation.mapper.SmartDormFloorMapper;
import cloudInformation.service.SmartDormFloorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: Smart School
 * @ClassName SmartDormFloorServiceImpl
 * @description:
 * @author: 陈智博
 * @create: 2025-04-17 15:36
 * @Version 1.0
 **/
@Service
public class SmartDormFloorServiceImpl implements SmartDormFloorService {

    @Autowired
    private SmartDormFloorMapper smartDormFloorMapper;

    @Override
    public PageBeanVO<SmartDormFloorVO> GetDormFloorByPage(String dormFloorName, Integer pageNum, Integer pageSize) {
        Integer pageBean = (pageNum - 1) * pageSize;
        Integer countSize = smartDormFloorMapper.GetDormFloorCount();
        List<SmartDormFloorVO> smartNewsDTOS = smartDormFloorMapper.GetDormFloorReturnPage(dormFloorName,pageBean,pageSize);
        return new PageBeanVO<>(pageNum,pageSize,countSize,smartNewsDTOS);
    }

    @Override
    public Integer InsertDormFloor(SmartDormFloorInsertDTO smartDormFloorInsertDTO) {
        return smartDormFloorMapper.InsertDormFloor(smartDormFloorInsertDTO);
    }

    @Override
    public Integer UpdateDormFloor(SmartDormFloorUpdateDTO smartDormFloorUpdateDTO) {
        return smartDormFloorMapper.UpdateDormFloor(smartDormFloorUpdateDTO);
    }
}
